package giftmail.job;

import java.util.Date;

/**
 * 自定义任务类
 * 执行业务任务
 * @author Demo
 *
 */
public class SpringQtz {
	private static int counter = 0;  
    protected void execute()  {  
        long ms = System.currentTimeMillis();  
        System.out.println("xxxxxxxxxxx" + new Date(ms));  
        System.out.println("(" + counter++ + ")");  
        
        //========举例 :将SpringQtz当做是一个service使用,引入Mapper方法,对数据库进行定时操作========
/*        @Autowired
    	private UserAppuserOrderinfoMapper tUserAppuserOrderinfoMapper;
        
        try {
			//本周用户订单数
			List<UserOrderCount> countList = tUserAppuserOrderinfoMapper.getWeekOrderCount("");
			if(countList !=null && countList.size()>0){
				for (UserOrderCount userOrderCount : countList) {
					//累计支付次数
					int payrewardTimes = userOrderCount.getCount();
					
					if(payrewardTimes>0){
						//APP累计支付奖励百事金信息
						TUserAppuserPayreward tUserAppuserPayreward = tUserAppuserPayrewardMapper.selectByPrimaryKey(payrewardTimes);
						
						//用户获取百事金
						TUserAppuserIntergration tUserAppuserIntergration = new TUserAppuserIntergration();
						String intergrationId=  DateUtils.getYear()+DateUtils.getMonth()+seqGeneratorUtil.getSeq(SequenceId.APPUSER_INTERGRATION_CODE).toString();
						tUserAppuserIntergration.setAppuserIntergrationId(intergrationId);
						tUserAppuserIntergration.setAppuserIntergrationName("完成任务奖励百事金");
						tUserAppuserIntergration.setAppuserIntergrationNum(tUserAppuserPayreward.getAppuserPayrewardNum());
						//获得百事金类型  1—签到；2—充值；3—邀请好友；4—注册；5—任务；7—新增场所；8—场所纠错；9：充值赠送 10—其他
						tUserAppuserIntergration.setAppuserIntergrationType("5");
						tUserAppuserIntergration.setAppuserIntergrationUser(userOrderCount.getUserId());
						tUserAppuserIntergration.setAppuserIntergrationCreatetime(new Date());
						//用户信息
						UserAppuserInfo userAppuserInfo = userAppuserInfoMapper.selectByPrimaryKey(userOrderCount.getUserId());
						tUserAppuserIntergration.setAppuserIntergrationOrgion(userAppuserInfo.getAppuserInfoDistinct());
						
						tUserAppuserIntergrationMapper.insert(tUserAppuserIntergration);
					}
					
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}*/
        
        
    } 
}
